//
//  OrderMessageTableViewCell.m
//  ForestPack
//
//  Created by 郑洲 on 2018/7/20.
//  Copyright © 2018年 郑洲. All rights reserved.
//

#import "OrderMessageTableViewCell.h"

@interface OrderMessageTableViewCell ()

@property (nonatomic, strong) UILabel *orderNum;
@property (nonatomic, strong) UILabel *createTime;
@property (nonatomic, strong) UILabel *payTime;
@property (nonatomic, strong) UILabel *sendTime;

@end

@implementation OrderMessageTableViewCell

+ (OrderMessageTableViewCell *)cellWithTableView:(UITableView *)tableView andIndexPath:(NSIndexPath *)indexPath{
    static NSString *cellID = @"OrderMessageTableViewCell";
    OrderMessageTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[OrderMessageTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.backgroundColor = [UIColor whiteColor];
        [cell createSubView];
    }
    
    return cell;
}

-(void)setShopOrderDetailModel:(ShopOrderDetailModel *)shopOrderDetailModel
{
    _shopOrderDetailModel = shopOrderDetailModel;
    
    self.orderNum.text = [NSString stringWithFormat:@"订单编号：%@",self.shopOrderDetailModel.order_no];
    self.createTime.text = [NSString stringWithFormat:@"创建时间：%@",self.shopOrderDetailModel.order_time];
    self.payTime.text = [NSString stringWithFormat:@"支付时间：%@",self.shopOrderDetailModel.pay_time];
    self.sendTime.text = [NSString stringWithFormat:@"发货时间：%@",self.shopOrderDetailModel.shipping_time];
    
}

- (void)createSubView {
    UILabel *noteLabel = [[UILabel alloc] initWithFrame:CGRectMake(ScreenX375(13), ScreenX375(14), ScreenX375(100), ScreenX375(16))];
    noteLabel.text = @"订单信息";
    noteLabel.textColor = FONTCOLOR_BLACK;
    noteLabel.font = Kfont(14);
    [self addSubview:noteLabel];
    
    NSArray *noteArr = @[@"订单编号：1234567890",@"创建时间：2018-07-19 21：16：07",@"支付时间：2018-07-19 21：16：07",@"发货时间：2018-07-19 21：16：07"];
    for (int i = 0; i < noteArr.count; i++) {
        UILabel *detailLabel = [[UILabel alloc] initWithFrame:CGRectMake(ScreenX375(13), ScreenX375(43) + i * ScreenX375(21), SCREEN_WIDTH - ScreenX375(26), ScreenX375(14))];
        detailLabel.text = noteArr[i];
        detailLabel.font = Kfont(12);
        detailLabel.textColor = FONTCOLOR_LIGHTGRAY;
        if (i == 0) {
            _orderNum = detailLabel;
        }else if (i == 1) {
            _createTime = detailLabel;
        }else if (i == 2) {
            _payTime = detailLabel;
        }else {
            _sendTime = detailLabel;
        }
        [self addSubview:detailLabel];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
